package com.example.Service.impl;

import com.example.Service.MoodDiaryService;
import com.example.entity.MoodDiary;
import com.example.mapper.MoodDiaryMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MoodDiaryServiceImpl implements MoodDiaryService {

    @Autowired
    private MoodDiaryMapper moodDiaryMapper;

    @Override
    public int addDiary(MoodDiary diary) {
        return moodDiaryMapper.insertMoodDiary(diary);
    }

    @Override
    public int deleteDiaryById(Integer diaryId) {
        return moodDiaryMapper.deleteMoodDiaryById(diaryId);
    }

    @Override
    public int updateDiary(MoodDiary diary) {
        return moodDiaryMapper.updateMoodDiary(diary);
    }

    @Override
    public List<MoodDiary> getDiariesByUserId(Integer userId) {
        return moodDiaryMapper.getMoodDiariesByUserId(userId);
    }
}

